# 测试类
# jwt原理测试
# import base64 ,json,time,hashlib
#
# # 头部信息
# heard_data = {'typ':'jwt','alg':"Hs256"}
# # 将字典格式转成字符串
# # json.dumps(heard_data)
# # 将字符串赚称字节对象
# head = base64.b64encode( json.dumps(heard_data).encode() ).decode()
# print('........Header头部Base64信息....')
# print(head)
#
#
# # 载荷部分：payload
# iat = int(time.time())
#
# payload_data = {
#     "sub":"admin",
#     "exp":iat+60*60,
#     "iat":iat,
#     "name":"chaojiyonghu",
#     "user_id":1,
#     "admin":True,
#     "acc_password":"asjdfalkfdjviaupwuradjPAHAFJSDF"
# }
#
# payload = base64.b64encode(json.dumps(payload_data).encode()).decode()
# print('........payload载荷部分Base64信息....')
# print(payload)
#
#
# # 第三部分：签证
# secret = 'django-insecure-mwap67jc^4l5db+xw55=8ou2*b)&nlo%x76i2x0w-(k+#9kevn'
# data = head+payload+secret
# hs256 = hashlib.sha256()
# # 传入数据，并修改编码格式
# hs256.update(data.encode('utf-8'))
# # 获取最终加密字符串
# signtrue = hs256.hexdigest()
# print('第三部分:签证')
# print(signtrue)
#
# # 最终jwt数据
# token = f'{head}.{payload}.{signtrue}'
#
#
# print('------最终jwt数据格式-----------')
# print(token)

# from ronglian_sms_sdk import SmsSDK

# accId = '2c94811c9035ff9f0192316e675c65b8'
# accToken = 'b82453403bec46bb964da9104f2ea32f'
# appId = '2c94811c9035ff9f0192316e694c65bf'

# def send_message():
#     sdk = SmsSDK(accId, accToken, appId)
#     tid = '1'
#     mobile = '15765089595'
#     datas = ('1234', '2')
#     resp = sdk.sendMessage(tid, mobile, datas)
#     print(resp)
#
# send_message()

# from ronglian_sms_sdk import SmsSDK
#
# accId = '2c94811c9035ff9f0191049077db2ae5'
# accToken = '0cf3a4ddd5bc47c9bd6c7359c5b7b5a4'
# appId = '2c94811c9035ff9f01923215ddcd66a2'
#
# def send_message():
#     sdk = SmsSDK(accId, accToken, appId)
#     tid = "1"
#     mobile = '18201275696'
#     datas = ('9823', '2')
#     resp = sdk.sendMessage(tid, mobile, datas)
#     print(resp)
#
# send_message()

import oss2,uuid

# 阿里云oss存储    --   测试文件上传  --  图片

# OSS_AccessKey_ID =  'LTAI5tGcYLpuzSxnPxuE2Mss'
# OSS_AccessKey_Secret =  'VI8iGdxOlD797sNFuQY3rewNQjnrUk'
# OSS_ENDPOINT = "oss-cn-beijing.aliyuncs.com"   #访问域名
# OSS_BUCKET_NAME = "fuguang0006" #存储空间名称

# 创建存储空间的操作实例对象
# 认证
# auth = oss2.Auth(OSS_AccessKey_ID,OSS_AccessKey_Secret)
#
# bucket = oss2.Bucket(auth,OSS_ENDPOINT,OSS_BUCKET_NAME)
# # http://128.0.0.1:9000/uploads/2024/2/s238dflansdf.png
# image_name = f'test/{str(uuid.uuid4())}.jpg'

# 查找一个文件（图片）
# with open('C:\\Users\\Administrator\\Desktop\\项目\\图片\\avatar\\2021\\default.jpg','rb') as f:
#     # 上传文件对象  --- 阿里云oss上传
#     # 文件名，文件对象：流
#     result = bucket.put_object(image_name,f.read())
#     print('----------上传结果------------')
#     print(result)







